package ssm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;

import ssm.entity.Employee;
import ssm.mapper.EmployeeMapper;

@Service("employeeService")
public class EmployeeServiceImpl implements EmployeeService {

	@Autowired
	private EmployeeMapper employeeMapper;

	@Override
	public Employee getEmpById(Integer id) {
		return employeeMapper.getEmpById(id);
	}

	@Override
	public PageInfo<Employee> list(Employee employee) {
		return employeeMapper.list(employee);
	}

	@Override
	public String update(Employee employee) {
		if (employee.getId() != null && employee.getId() > 0) {
			employeeMapper.update(employee);
		} else {
			employeeMapper.insert(employee);
		}
		return "200";
	}

}
